package io.forlove.myrtle;

import io.forlove.myrtle.files.FilesWatcher;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class MyrtleApplication  implements CommandLineRunner {

    public static void main(String[] args) {
        SpringApplication.run(MyrtleApplication.class, args);
    }

    @Autowired
    private FilesWatcher filesWatcher;

    @Override
    public void run(String... args) throws Exception {
        new Thread(new Runnable() {
            @Override
            public void run() {
                filesWatcher.watch();
            }
        }).start();

    }
}
